package com.anywide.controller.user;
import java.io.PrintWriter;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;
import com.anywide.dawdler.client.Transaction;
import com.anywide.dawdler.client.TransactionProvider;
import com.anywide.dawdler.clientplug.annotation.RequestMapping;
import com.anywide.dawdler.clientplug.annotation.RequestMapping.ViewType;
import com.anywide.dawdler.clientplug.web.AntPathMatcher;
import com.anywide.dawdler.clientplug.web.TransactionController;
public class UserController extends TransactionController{
	@RequestMapping(value = "/index.html",generateValidator=true)
	public void test() throws Exception {
		 System.out.println(getParamsVariable("abc"));
		 String demo = paramString("demo");
		 System.out.println(demo);
		 Transaction tr = TransactionProvider.getTransaction();
		 tr.setServiceName("userRemote");
		 tr.setMethod("selectUser");
//		 com.anywide.bean.user.User user = new com.anywide.bean.user.User();
//		 tr.addParam(com.anywide.bean.user.User.class, user);
		 Object obj = tr.executeResult();
		 Map map = new HashMap<>();
		 map.put("list",obj);
		 setData(map);
		 setTemplatePath("index.html");
		 PrintWriter out = getResponse().getWriter();
		 out.println("");
		 out.flush();
		 out.close();
//		 setStatusToStop();
//		 setStatusToRedirect();
//		 setTemplatePath("hello.html");
//		 getResponse().sendRedirect("hello.html");
	}
	@RequestMapping(value = "/registe.do",viewType=ViewType.json,input="index.html")
	public void registe() throws Exception {
		 System.out.println(getParamsVariable("abc"));
		 String demo = paramString("demo");
		 System.out.println(demo);
		 Transaction tr = TransactionProvider.getTransaction();
		 tr.setServiceName("userRemote");
		 tr.setMethod("selectUser");
		 Object obj = tr.executeResult();
		 Map map = new HashMap<>();
		 map.put("list",obj);
		 setData(map);
		 setStatusToStop();
	}

}
